IHierarchyItem.UpdateProperties Implementation Example

IT Hit WebDAV Server Engine

public virtual WebDAVResponse UpdateProperties(Property[] setProps, Property[] delProps)

{

      MultipropResponse resp = new MultipropResponse();

 

      SqlConnection conn = new SqlConnection(connStr);

      SqlTransaction trans = null;

      try

      {

            conn.Open();

            trans = conn.BeginTransaction();

 

            if(setProps != null)

                  foreach(Property p in setProps)

                  {

                        SetProperty(p, trans); // create or update property

                        resp.AddResponses(new PropResponse(p, new OkResponse()));

                  }

       

            if(delProps != null)

                  foreach(Property p in delProps)

                  {

                        RemoveProperty(p.Name, p.Namespace, trans);

                        resp.AddResponses(new PropResponse(p, new OkResponse()));

                  }

       

            UpdateModified(trans);

       

            trans.Commit();

      }

      catch

      {

            if(trans != null) trans.Rollback();

            return new ServerErrorResponse();

      }

      finally

      {

            conn.Close();

      }

   

      return resp;

}